Repository navigation
Number consensus lock holds in trace events - #8779
Closed
cjen1-msft wants to merge 1 commit into
Closed
cjen1-msft wants to merge 1 commit into
cjen1-msft wants to merge 1 commit into
Conversation
Trace events declared with DECLARE_TRACE_EVENT record lock_hold, the hold of a TracedMutex they are emitted in, and the consensus state lock is now one. A trace consumer can then check that the lock serializes each node's events instead of assuming it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Nov 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Consensus trace consumers, such as the Lean replayer, rely on every consensus event being emitted while the node holds its consensus lock: that is what makes a node's event order a serial order of its critical sections, whichever threads ran them. Nothing checks this today, so a change that traces outside the lock, or releases it part-way through a section, would silently weaken trace validation.
This PR makes the assumption visible in the trace. Each consensus event records
lock_hold, the number of the lock hold it was emitted in, or 0 if it was emitted outside the lock, so a consumer can check that each group of events is exactly one hold instead of assuming it. Checking the field in the replayer is left to a follow-up, once #8735 has landed.Safety and compatibility
aft::State::lockbecomes accf::tracing::TracedMutex, which adds a few thread-local accesses and a counter increment per acquisition, with or without tracing enabled. Locking behaviour is otherwise unchanged.Events under the
ccf.cftFluentd tag gain alock_holdfield inmsg; the record envelope is unchanged and collectors need no configuration change.